//
//  ViewController.swift
//  LJJCycleDemo
//
//  Created by liujunjie on 2019/1/29.
//  Copyright © 2019 junjie.liu. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let array = ["本地加载 -不带标题的图片轮播器",
                        "网络加载 -不带标题的图片轮播器",
                        "网络加载 -带标题的图片轮播器",
                        "纯文字的轮播器","1","1","1","1","1","1","1",]
        
        for i in 0..<array.count {
            
            let btn = UIButton(type: .custom)
            btn.backgroundColor = UIColor.lightGray
            btn.setTitle(array[i], for: .normal)
            btn.setTitleColor(UIColor.black, for: .normal)
            btn.frame = CGRect(x: 60, y: 80 + 60*i, width: Int(self.view.ljj_width - 120), height: 40)
            btn.tag = i
            btn.titleLabel?.font = UIFont.systemFont(ofSize: 12)
            btn.addTarget(self, action: #selector(self.action(_:)), for: .touchUpInside)
            self.view.addSubview(btn)
        }
    }
    
    @objc func action( _ btn: UIButton) {
        
        switch btn.tag {
        case 0:
            self.present(TagZeroVC(), animated: true, completion: nil)
            break
        case 1:
            self.present(TagOneVC(), animated: true, completion: nil)
            break
        case 2:
           self.present(TagTwoVC(), animated: true, completion: nil)
            break
        case 3:
            self.present(TagThreeVC(), animated: true, completion: nil)
            break
        default:break
        }
        
    }
}

